import request from "@/utils/request";

/**
 * 工序任务api接口集合
 * @method getList 列表
 * @method postAdd 新增
 * @method putEdit 修改
 * @method deleteDel 删除
 */

export function getList(params) {
  return request({
    url: "/mes/processTaskController/list",
    method: "get",
    params,
  });
}
export function postAdd(data) {
  return request({
    url: "/mes/processTaskController/add",
    method: "post",
    data: data,
  });
}
export function putEdit(data) {
  return request({
    url: "/mes/processTaskController/edit",
    method: "put",
    data: data,
  });
}
export function deleteDel(ids) {
  return request({
    url: "/mes/processTaskController/" + ids,
    method: "delete",
  });
}
export function getObject(id) {
  return request({
    url: "/mes/processTaskController/" + id,
    method: "get",
  });
}

/**
 * 使用工序任务，获取已经选择的设备信息和可以选择的设备信息
 * @param params
 * @returns
 */
export function deviceReferListByProcess(params) {
  return request({
    url: "/mes/processTaskController/referLinkDevice",
    method: "get",
    params,
  });
}

/**
 * 使用工序任务，获取已经选择的设备信息和可以选择的设备信息
 * @param params
 * @returns
 */
export function listUsedDevice(params) {
  return request({
    url: "/device/deviceBorrowBillController/listUsedByBus",
    method: "get",
    params,
  });
}

/**
 * 使用工序任务，获取工单的信息，
 * @param id 工序任务的住建
 * @returns {*} 工单的显示对象
 */
export function getWorkOrder(id,loading){
  return request({
    url:'/mes/processTaskController/getWorkOrderByTaskId?id='+id,
    method:'get',
    resField: 'obj',
    loading
  });
}
export function apiGetTakeNumber(params,loading) {
  return request({
    url: "/mes/takeNumberController/grid",
    method: "get",
    autoUntie: false,
    params,
    loading
  });
}
export function getBusFile(params) {
  return request({
    url: "/mes/fileController/listFiles",
    method: "get",
    params,
  });
}
export function listDeviceHasAccount(params) {
  return request({
    url: "/mes/processTaskController/listDeviceHasAccount",
    method: "get",
    params,
  });
}
export  function listDeviceByProcess(params){
  return request({
    url: "/mes/processTaskController/listDeviceByProcess",
    method: "get",
    params,
  });
}
export function listLinkDevice(params) {
  return request({
    url: "/mes/processTaskController/listLinkDevice",
    method: "get",
    params,
  });
}
export function listLinkedDeviceByProcess(params) {
  return request({
    url: "/mes/processTaskController/listLinkedDeviceByProcess",
    method: "get",
    params,
  });
}

